﻿<Views:WindowBase x:Class="SharpTalk.Client.WpfApplication.Views.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:Resources="clr-namespace:SharpTalk.Client.WpfApplication.Resources"
        xmlns:Views="clr-namespace:SharpTalk.Client.WpfApplication.Views"
        Style="{StaticResource MainWindowStyle}">
    <Views:WindowBase.TaskbarItemInfo>
        <TaskbarItemInfo ProgressState="{Binding ApplicationStates.IsBusy, Converter={StaticResource BooleanToTaskbarItemProgressStateConverter}}" >
            <TaskbarItemInfo.ThumbButtonInfos>
                <ThumbButtonInfo Description="{x:Static Resources:Messages.label_exit}"  Command="{Binding ExitCommand}" ImageSource="/SharpTalk.Client.WpfApplication;component/Images/exit_16.png"/>
                <ThumbButtonInfo Description="{Binding CurrentUser.Status, Converter={StaticResource UserStatusEnumConverter}}"  Command="{Binding ChangeStatusCommand}" CommandParameter="{Binding CurrentUser}"  IsEnabled="{Binding HasUser}" ImageSource="{Binding CurrentUser.Status,Converter={StaticResource UserStatusToImageSourceConverter}}" IsBackgroundVisible="{Binding HasUser}" />
            </TaskbarItemInfo.ThumbButtonInfos>
        </TaskbarItemInfo>
    </Views:WindowBase.TaskbarItemInfo>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition/>
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Menu x:Name="mainMenu" Grid.Row="0" IsMainMenu="True" >
            <MenuItem Header="{x:Static Resources:Messages.label_menu_file}">
                <MenuItem Header="{x:Static Resources:Messages.label_menu_login}" Command="{Binding LoginCommand}" IsEnabled="{Binding IsReady}">
                    <MenuItem.Icon>
                        <Image Style="{StaticResource ImageLogonStyle}" />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="{x:Static Resources:Messages.label_menu_logout}" Command="{Binding LogoutCommand}" IsEnabled="{Binding IsReady}">
                    <MenuItem.Icon>
                        <Image Style="{StaticResource ImageLogoutStyle}" />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="{x:Static Resources:Messages.label_menu_edit_user}" Command="{Binding EditUserCommand}"  IsEnabled="{Binding HasUser}">
                    <MenuItem.Icon>
                        <Image Style="{StaticResource ImageUserDetailsStyle}"/>
                    </MenuItem.Icon>
                </MenuItem>
                <!--<Separator/>-->
                <MenuItem Header="{x:Static Resources:Messages.label_menu_exit}" Command="{Binding ExitCommand}" >
                    <MenuItem.Icon>
                        <Image Style="{StaticResource ImageExitStyle}"/>
                    </MenuItem.Icon>
                </MenuItem>
            </MenuItem>
            <MenuItem Header="{x:Static Resources:Messages.label_menu_chatrooms}" IsEnabled="{Binding IsOnline}">
                <MenuItem Header="{x:Static Resources:Messages.label_menu_chatroom_create}" Command="{Binding ChatRoomCreateCommand}">
                    <MenuItem.Icon>
                        <Image Style="{StaticResource ImageChatNewStyle}"/>
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="{x:Static Resources:Messages.label_menu_chatroom_search}" Command="{Binding ChatRoomSearchCommand}">
                    <MenuItem.Icon>
                        <Image Style="{StaticResource ImageChatRoomSearch}"/>
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="{x:Static Resources:Messages.label_menu_chatroom_join}" Command="{Binding ChatRoomJoinCommand}">
                    <MenuItem.Icon>
                        <Image Style="{StaticResource ImageJoin}"/>
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="{x:Static Resources:Messages.label_menu_my_chatrooms}" ItemsSource="{Binding CreatedChatRooms}" ItemContainerStyle="{StaticResource MenuItemChatRoomJoinStyle}" >
                    <MenuItem.Icon>
                        <Image Style="{StaticResource ImageMyChatrooms}"/>
                    </MenuItem.Icon>
                </MenuItem>
            </MenuItem>
            <!--<MenuItem Header="{x:Static Resources:Messages.label_menu_addressbook}">
                <MenuItem Header="{x:Static Resources:Messages.label_menu_contacts}" ItemsSource="{Binding Contacts}" ItemContainerStyle="{StaticResource MenuItemContactStyle}">
                    <MenuItem.Icon>
                        <Image Style="{StaticResource ImageStyleContact}"/>
                    </MenuItem.Icon>
                </MenuItem>
            </MenuItem>-->
            <MenuItem Header="{x:Static Resources:Messages.label_menu_options}">
                <MenuItem Header="{x:Static Resources:Messages.label_menu_settings}" Command="{Binding SettingsCommand}" IsEnabled="{Binding CanUpdateUserSettings}">
                    <MenuItem.Icon>
                        <Image Style="{StaticResource ImageSettingsStyle}"/>
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="{x:Static Resources:Messages.label_menu_spellcheck}" IsCheckable="True" IsChecked="{Binding CheckSpelling}" StaysOpenOnClick="True"/>
            </MenuItem>
            <MenuItem Header="{x:Static Resources:Messages.label_menu_help}">
                <MenuItem Header="{Binding About}" Command="{Binding AboutCommand}">
                    <MenuItem.Icon>
                        <Image Style="{StaticResource ImageAboutStyle}"/>
                    </MenuItem.Icon>
                </MenuItem>
            </MenuItem>
        </Menu>
        <ContentControl x:Name="MainWindowContent" Focusable="False" Grid.Row="1" Style="{StaticResource MainContentStyle}"/>
        <StatusBar Grid.Row="2" Height="Auto" Background="White">
            <StatusBarItem Visibility="{Binding HasUser, Converter={StaticResource BooleanToVisibilityConverter}}">
                <Button Style="{StaticResource FlatButtonStyle }" Focusable="false" Command="{Binding ChangeStatusCommand}" CommandParameter="{Binding CurrentUser}"  IsEnabled="{Binding IsReady}">
                    <Image Style="{StaticResource ImageStyleUserStatus}" VerticalAlignment="Center" />
                </Button>
            </StatusBarItem>
            <Separator Style="{StaticResource SeparatorDefaultStyle}"/>
            <StatusBarItem Visibility="{Binding IsReady, Converter={StaticResource BooleanToVisibilityConverter}}">
                <TextBlock Text="{Binding CurrentUser.FullName}" VerticalAlignment="Center"/>
            </StatusBarItem>
            <StatusBarItem HorizontalContentAlignment="Right" >
                <ProgressBar Visibility="{Binding ApplicationStates.IsBusy, Converter={StaticResource BooleanToVisibilityConverter}}"
                    Margin="2,1,10,1" 
                    Width="70" 
                    VerticalAlignment="Center"
                    IsIndeterminate="True"/>
            </StatusBarItem>
        </StatusBar>
    </Grid>
</Views:WindowBase>
